package main

import "fmt"

type Person struct {
	name   string
	age    int
	gender string
	score  float64
}

// Eat 在类外绑定方法
// 指针可以修改原有的值
func (this *Person) Eat() {
	fmt.Println("Person is eating")
	//类的方法可以使用自己的成员

	fmt.Println(this.name + ".....")
	this.name = "cao"
}

func main() {
	lily := Person{
		name:   "lily",
		age:    30,
		gender: "女生",
		score:  80,
	}

	fmt.Println("lily: ", lily)
	lily.Eat()
	fmt.Println("修改后：", lily)
}
